﻿using System.Globalization;
using System.Windows.Data;
using Windows.UI.Xaml;

namespace CoreModule.Converters
{
    /// <summary>
    /// 范围内 显示
    /// </summary>
    public class DoubleRangeToVisibilityConverter : IValueConverter
    {
      
        /// <summary>
        /// 包括
        /// </summary>
        public double Min { get; set; }
        /// <summary>
        /// 不包括
        /// </summary>
        public double Max { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var v = (double)value;

            if (v>=Min && v<Max)
            {
                return Visibility.Visible;
            }
            else
            {
                return Visibility.Collapsed;
            }
           
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
